﻿@using System.Reflection
@using NewLife.Cube
@using XCode
@using XCode.Configuration
@{
    Layout = NewLife.Cube.Setting.Current.Layout;

    var entity = Model as IEntity;
    var isNew = entity.IsNullKey;

    var rv = entity.GetRouteKey();
}

<div class="form-horizontal">
    @Html.PartialAsync("_Form_Header", entity).Result
    @using (Html.BeginForm((isNew ? "Add" : "Edit"), null, rv))
    {
        @Html.AntiForgeryToken()
        @*@Html.ValidationSummary()*@
        //解决主键为(0长度字符串"")的异常信息无法显示问题
        <ul>
            @foreach (var item in ViewData.ModelState.Values)
            {
                foreach (var error in item.Errors)
                {
                    <li>@error.Exception</li>
                }
            }
        </ul>
        @Html.PartialAsync("_Form_Body", entity).Result
    }
</div>
